//
//  ImageBrowseTableViewCell.m
//  ImageBrowse
//
//  Created by bike on 17/1/19.
//  Copyright © 2017年 bike. All rights reserved.
//

#import "ImageBrowseTableViewCell.h"

@interface ImageBrowseTableViewCell()

@end

@implementation ImageBrowseTableViewCell

+ (float)cellHeight
{
    return 100;
}

+ (NSString *)identifier
{
    return NSStringFromClass([self class]);
}

+ (void)registerInTableView:(UITableView *)tableView
{
    [tableView registerNib:[UINib nibWithNibName:NSStringFromClass([self class]) bundle:nil] forCellReuseIdentifier:[self identifier]];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    id object = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    return object;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    _cellImageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapAction)];
    [_cellImageView addGestureRecognizer:tap];
}

- (void)reloadWithImageName:(NSString *)imageName
{
    _cellImageView.image = [UIImage imageNamed:imageName];
}

- (void)imageTapAction
{
    if ([_delegate respondsToSelector:@selector(tapAtImageWithCell:)]) {
        [_delegate tapAtImageWithCell:self];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
